<template>
  <div class="container">
    <h1 class="subtitle">联系我们</h1>
    <div class="info">
      <mt-field label="用户名" placeholder="请输入用户名" v-model="form.name"></mt-field>
      <mt-field label="邮箱" placeholder="请输入邮箱" type="email" v-model="form.email"></mt-field>
      <mt-field label="手机号" placeholder="请输入手机号" type="tel" v-model="form.phone"></mt-field>
      <mt-field label="生日" placeholder="请输入生日" type="date" v-model="form.date"></mt-field>

      <mt-checklist title="兴趣爱好" v-model="hoby" :options="['唱歌', '跳舞', 'Rap']"></mt-checklist>

      <mt-field label="自我介绍" placeholder="自我介绍" type="textarea" rows="4" v-model="form.introduce"></mt-field>
      <br />
      <mt-button type="primary" size="large" plain @click="onSubmit">提交</mt-button>
      <br />
      <mt-button type="primary" size="large" plain>取消</mt-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hoby: [],
      form: {
        name: "",
        email: "",
        phone: "",
        date: "",
        introduce: "",
        hobby: ""
      }
    };
  },
  methods: {
    onSubmit() {
      this.form.hobby = this.hoby.join(",");
      this.$store.commit("addtomessages", this.form);
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  padding: 10px;
  .subtitle {
    font-size: 16px;
    text-align: center;
  }
  .info {
    margin: 5px, 5px;
  }
}
</style>